package com.tanhua.houtai.server.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.domain.mongo.SoundTime;
import com.tanhua.domain.vo.PageResult;
import com.tanhua.houtai.server.service.SoundTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/sound")
public class SountTimeController {
    @Autowired
    private SoundTimeService soundTimeService;
    @RequestMapping("/getsoundtime1")
    public PageResult getall(@RequestBody HashMap<String,Object> map){
        int page = (int) map.get("current");
        int pagesize = (int) map.get("size");
        String id = map.get("id").toString();
        PageResult getsound= soundTimeService.getList(page,pagesize,id);
        return getsound;
    }

    @RequestMapping("/updateAd")
    public void updatehide(String id){
        soundTimeService.updatehide(id);
    }

    @RequestMapping("/updateTime")
    public void updateTime(@RequestBody HashMap<String, Object> map){
        String id = map.get("id").toString();
        String  time = map.get("time").toString();
        soundTimeService.updateTime(id,time);
    }
}
